import angular from 'angular';
/**
 * zhx.media.review Directive
 * Author: Vicco Wang
 * Date: 2017/10/18
 * Version : 1.0.0
 *
 */
angular.module('zhx.media.review').directive('zhxMediaReview',['$timeout','zhxMediaReview.util',($timeout,zhxMediaReviewUtil)=>({
    restrict : 'E',
    scope : {
        options : '='
    },
    replace : true,
    controller : 'zhxMediaReviewController',
    link : (scope, tElement, tAttrs) => {

        //设置一个宽度,始终保持16:9格式;
        scope.baseSize = scope.options.baseSize || zhxMediaReviewUtil.getCurrentSize();
        scope.baseRatio = parseFloat(1920 / scope.baseSize.width).toFixed(2);
        //绑定窗口缩放后的Size
        // window.onresize = () => {
        //     $timeout(()=>{
        //         scope.baseSize = zhxMediaReviewUtil.getCurrentSize();
        //         scope.baseRatio = parseFloat(1920 / scope.baseSize.width).toFixed(2);
        //         scope.$digest();
        //     })
        // };

    },
    template : require('../template/zhx.media.review.html')
})]);
